home *** CD-ROM | disk | FTP | other *** search
/ Aminet 15 / Aminet 15 - Nov 1996.iso / Aminet / dev / basic / ace24dist.lha / ace24.lha / include / devices / trackdisk.h < prev   
C/C++ Source or Header  |  1996-09-10  |  9KB  |  277 lines

  1. #ifndef DEVICES_TRACKDISK_H
  2. #define DEVICES_TRACKDISK_H 1
  3. /*
  4. ** trackdisk.h for ACE Basic
  5. **
  6. ** Note: Translated to ACE by ConvertC2ACE
  7. **       @ MapMeadow Software, Nils Sjoholm
  8. **
  9. **
  10. ** Date: 09/03/95
  11. **
  12. **
  13. */
  14.  
  15.  
  16. /*
  17. ** This are the StructPointer defines for trackdisk.h
  18. */
  19. #ifndef DriveGeometryPtr
  20. #define DriveGeometryPtr ADDRESS
  21. #endif
  22. #ifndef IOExtTDPtr
  23. #define IOExtTDPtr ADDRESS
  24. #endif
  25. #ifndef TDU_PublicUnitPtr
  26. #define TDU_PublicUnitPtr ADDRESS
  27. #endif
  28. /*
  29. ** End of StructPointer defines for trackdisk.h
  30. */
  31.         
  32. #ifndef EXEC_IO_H
  33. #include <exec/io.h>
  34. #endif
  35.  
  36. #ifndef EXEC_DEVICES_H
  37. #include <exec/devices.h>
  38. #endif
  39.  
  40.  
  41. /*
  42.  *--------------------------------------------------------------------
  43.  *
  44.  * Physical drive constants
  45.  *
  46.  *--------------------------------------------------------------------
  47.  */
  48.  
  49. /* OBSOLETE -- use the TD_GETNUMTRACKS command! */
  50. /*#define   NUMCYLS 80*/        /*  normal # of cylinders */
  51. /*#define   MAXCYLS (NUMCYLS+20)*/  /* max # cyls to look for during cal */
  52. /*#define   NUMHEADS 2*/
  53. /*#define   NUMTRACKS (NUMCYLS*NUMHEADS)*/
  54.  
  55. #define NUMSECS 11
  56. #define NUMUNITS 4
  57.  
  58. /*
  59.  *--------------------------------------------------------------------
  60.  *
  61.  * Useful constants
  62.  *
  63.  *--------------------------------------------------------------------
  64.  */
  65.  
  66. /*-- sizes before mfm encoding */
  67. #define TD_SECTOR 512
  68. #define TD_SECSHIFT 9       /* log TD_SECTOR */
  69.  
  70. /*
  71.  *--------------------------------------------------------------------
  72.  *
  73.  * Driver Specific Commands
  74.  *
  75.  *--------------------------------------------------------------------
  76.  */
  77.  
  78. /*
  79.  *-- TD_NAME is a generic macro to get the name of the driver.  This
  80.  *-- way if the name is ever changed you will pick up the change
  81.  *-- automatically.
  82.  *--
  83.  *-- Normal usage would be:
  84.  *--
  85.  *-- BYTE internalName[] = TD_NAME 
  86.  *--
  87.  */
  88.  
  89. #define TD_NAME "trackdisk.device"
  90.  
  91. #define TDF_EXTCOM (32768)      /* for internal use only! */
  92.  
  93.  
  94. #define TD_MOTOR    (CMD_NONSTD+0)  /* control the disk's motor */
  95. #define TD_SEEK     (CMD_NONSTD+1)  /* explicit seek (for testing) */
  96. #define TD_FORMAT   (CMD_NONSTD+2)  /* format disk */
  97. #define TD_REMOVE   (CMD_NONSTD+3)  /* notify when disk changes */
  98. #define TD_CHANGENUM    (CMD_NONSTD+4)  /* number of disk changes */
  99. #define TD_CHANGESTATE  (CMD_NONSTD+5)  /* is there a disk in the drive? */
  100. #define TD_PROTSTATUS   (CMD_NONSTD+6)  /* is the disk write protected? */
  101. #define TD_RAWREAD  (CMD_NONSTD+7)  /* read raw bits from the disk */
  102. #define TD_RAWWRITE (CMD_NONSTD+8)  /* write raw bits to the disk */
  103. #define TD_GETDRIVETYPE (CMD_NONSTD+9)  /* get the type of the disk drive */
  104. #define TD_GETNUMTRACKS (CMD_NONSTD+10) /* # of tracks for this type drive */
  105. #define TD_ADDCHANGEINT (CMD_NONSTD+11) /* TD_REMOVE done right */
  106. #define TD_REMCHANGEINT (CMD_NONSTD+12) /* remove softint set by ADDCHANGEINT */
  107. #define TD_GETGEOMETRY  (CMD_NONSTD+13) /* gets the disk geometry table */
  108. #define TD_EJECT    (CMD_NONSTD+14) /* for those drives that support it */
  109. #define TD_LASTCOMM (CMD_NONSTD+15)
  110.  
  111. /*
  112.  *
  113.  * The disk driver has an "extended command" facility.  These commands
  114.  * take a superset of the normal IO Request block.
  115.  *
  116.  */
  117.  
  118. #define ETD_WRITE   (CMD_WRITE OR TDF_EXTCOM)
  119. #define ETD_READ    (CMD_READ OR TDF_EXTCOM)
  120. #define ETD_MOTOR   (TD_MOTOR OR TDF_EXTCOM)
  121. #define ETD_SEEK    (TD_SEEK OR TDF_EXTCOM)
  122. #define ETD_FORMAT  (TD_FORMAT OR TDF_EXTCOM)
  123. #define ETD_UPDATE  (CMD_UPDATE OR TDF_EXTCOM)
  124. #define ETD_CLEAR   (CMD_CLEAR OR TDF_EXTCOM)
  125. #define ETD_RAWREAD (TD_RAWREAD OR TDF_EXTCOM)
  126. #define ETD_RAWWRITE    (TD_RAWWRITE OR TDF_EXTCOM)
  127.  
  128. /*
  129.  *
  130.  * extended IO has a larger than normal io request block.
  131.  *
  132.  */
  133.  
  134. STRUCT IOExtTD  
  135.     IOStdReq iotd_Req 
  136.     LONGINT   iotd_Count 
  137.     LONGINT   iotd_SecLabel 
  138. END STRUCT 
  139.  
  140. /*
  141.  *  This is the structure returned by TD_DRIVEGEOMETRY
  142.  *  Note that the layout can be defined three ways:
  143.  *
  144.  *  1. TotalSectors
  145.  *  2. Cylinders and CylSectors
  146.  *  3. Cylinders,  Heads,  and TrackSectors.
  147.  *
  148.  *  #1 is most accurate,  #2 is less so,  and #3 is least accurate.  All
  149.  *  are usable,  though #2 and #3 may waste some portion of the available
  150.  *  space on some drives.
  151.  */
  152. STRUCT DriveGeometry  
  153.     LONGINT   dg_SectorSize       /* in bytes */
  154.     LONGINT   dg_TotalSectors     /* total # of sectors on drive */
  155.     LONGINT   dg_Cylinders        /* number of cylinders */
  156.     LONGINT   dg_CylSectors       /* number of sectors/cylinder */
  157.     LONGINT   dg_Heads        /* number of surfaces */
  158.     LONGINT   dg_TrackSectors     /* number of sectors/track */
  159.     LONGINT   dg_BufMemType       /* preferred buffer memory type */
  160.                     /* (usually MEMF_PUBLIC) */
  161.     BYTE    dg_DeviceType       /* codes as defined in the SCSI-2 spec*/
  162.     BYTE    dg_Flags        /* flags,  including removable */
  163.     SHORTINT   dg_Reserved 
  164. END STRUCT 
  165.  
  166. /* device types */
  167. #define DG_DIRECT_ACCESS    0
  168. #define DG_SEQUENTIAL_ACCESS    1
  169. #define DG_PRINTER      2
  170. #define DG_PROCESSOR        3
  171. #define DG_WORM         4
  172. #define DG_CDROM        5
  173. #define DG_SCANNER      6
  174. #define DG_OPTICAL_DISK     7
  175. #define DG_MEDIUM_CHANGER   8
  176. #define DG_COMMUNICATION    9
  177. #define DG_UNKNOWN      31
  178.  
  179. /* flags */
  180. #define DGB_REMOVABLE       0
  181. #define DGF_REMOVABLE       1
  182.  
  183. /*
  184. ** raw read and write can be synced with the index pulse.  This flag
  185. ** in io request's IO_FLAGS field tells the driver that you want this.
  186. */
  187.  
  188. #define IOTDB_INDEXSYNC 4
  189. #define IOTDF_INDEXSYNC (16)
  190. /*
  191. ** raw read and write can be synced with a $4489 sync pattern.  This flag
  192. ** in io request's IO_FLAGS field tells the driver that you want this.
  193. */
  194. #define IOTDB_WORDSYNC  5
  195. #define IOTDF_WORDSYNC (32)
  196.  
  197.  
  198. /* labels are TD_LABELSIZE bytes per sector */
  199.  
  200. #define TD_LABELSIZE 16
  201.  
  202. /*
  203. ** This is a bit in the FLAGS field of OpenDevice.  If it is set,  then
  204. ** the driver will allow you to open all the disks that the trackdisk
  205. ** driver understands.  Otherwise only 3.5" disks will succeed.
  206. */
  207.  
  208. #define TDB_ALLOW_NON_3_5   0
  209. #define TDF_ALLOW_NON_3_5   (1)
  210.  
  211. /*
  212. **  If you set the TDB_ALLOW_NON_3_5 bit in OpenDevice,  then you don't
  213. **  know what type of disk you really got.  These defines are for the
  214. **  TD_GETDRIVETYPE command.  In addition,  you can find out how many
  215. **  tracks are supported via the TD_GETNUMTRACKS command.
  216. */
  217.  
  218. #define DRIVE3_5    1
  219. #define DRIVE5_25   2
  220. #define DRIVE3_5_150RPM 3
  221.  
  222. /*
  223.  *--------------------------------------------------------------------
  224.  *
  225.  * Driver error defines
  226.  *
  227.  *--------------------------------------------------------------------
  228.  */
  229.  
  230. #define TDERR_NotSpecified  20  /* general catchall */
  231. #define TDERR_NoSecHdr      21  /* couldn't even find a sector */
  232. #define TDERR_BadSecPreamble    22  /* sector looked wrong */
  233. #define TDERR_BadSecID      23  /* ditto */
  234. #define TDERR_BadHdrSum     24  /* header had incorrect checksum */
  235. #define TDERR_BadSecSum     25  /* data had incorrect checksum */
  236. #define TDERR_TooFewSecs    26  /* couldn't find enough sectors */
  237. #define TDERR_BadSecHdr     27  /* another "sector looked wrong" */
  238. #define TDERR_WriteProt     28  /* can't write to a protected disk */
  239. #define TDERR_DiskChanged   29  /* no disk in the drive */
  240. #define TDERR_SeekError     30  /* couldn't find track 0 */
  241. #define TDERR_NoMem     31  /* ran out of memory */
  242. #define TDERR_BadUnitNum    32  /* asked for a unit > NUMUNITS */
  243. #define TDERR_BadDriveType  33  /* not a drive that trackdisk groks */
  244. #define TDERR_DriveInUse    34  /* someone else allocated the drive */
  245. #define TDERR_PostReset     35  /* user hit reset  awaiting doom */
  246.  
  247. /*
  248.  *--------------------------------------------------------------------
  249.  *
  250.  * public portion of the unit structure
  251.  *
  252.  *--------------------------------------------------------------------
  253.  */
  254.  
  255. STRUCT TDU_PublicUnit  
  256.     Unit tdu_Unit       /* base message port */
  257.     SHORTINT   tdu_Comp01Track     /* track for first precomp */
  258.     SHORTINT   tdu_Comp10Track     /* track for second precomp */
  259.     SHORTINT   tdu_Comp11Track     /* track for third precomp */
  260.     LONGINT   tdu_StepDelay       /* time to wait after stepping */
  261.     LONGINT   tdu_SettleDelay     /* time to wait after seeking */
  262.     BYTE    tdu_RetryCnt        /* # of times to retry */
  263.     BYTE    tdu_PubFlags        /* public flags,  see below */
  264.     SHORTINT   tdu_CurrTrk         /* track the heads are over... */
  265.                     /* ONLY ACCESS WHILE UNIT IS STOPPED! */
  266.     LONGINT   tdu_CalibrateDelay  /* time to wait after stepping */
  267.                     /* during a recalibrate */
  268.     LONGINT   tdu_Counter         /* counter for disk changes... */
  269.                     /* ONLY ACCESS WHILE UNIT IS STOPPED! */
  270. END STRUCT 
  271.  
  272. /* flags for tdu_PubFlags */
  273. #define TDPB_NOCLICK    0
  274. #define TDPF_NOCLICK    (1)
  275.  
  276. #endif  /* DEVICES_TRACKDISK_H */
  277.